<template>
  <div>
        <!-- start:自定义页面内容 -->
    <el-dialog title="请扫码健康卡二维码" width="80%" :visible.sync="showWaitingModal"
    :before-close="handleClose" >
      <h1>1、已有电子健康卡患者，可直接使用电子健康卡二维码预约、挂号，缴费及检验报告打印</h1>
      <h1>2、无电子健康卡患者，需先进行“自助建档”。打印出电子健康卡二维码后，凭此二维码进行预约、挂号，缴费及检验报告打印</h1>
      <el-row style="padding:0" :gutter="20">
        <el-col :span="12">
          <el-card :body-style="{ padding:'0px' }">
            <img style="width:100%;display:block;" :src="readingUrl" class="image" />
          </el-card>
        </el-col>
        <el-col :span="12" style="display:flex;align-items:center;">
          <el-input ref="autofocus" v-model="cardNo" autocomplete="off" @change="ReadedCard()">
            <template slot="prepend">健康卡二维码:</template>
          </el-input>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer"></div>
    </el-dialog>
        <!-- end:自定义页面内容 -->
  </div>
</template>

<script>
import readingDzjkk from "@images/readcard/reading01.png";
export default {
  name: "Dzjkk",
  data() {
    return {
      cardNo: "",
      showWaitingModal: true,
      readingUrl:this.loginUrl,//readingDzjkk,
    };
  },
  props:{
    loginUrl:String,
  },
  methods: {
      ReadedCard() {
         var orgid = this.$store.state.terminfo.orginfo.orgid;
         var sendCardNo;
         if(orgid=='syyt'){
            sendCardNo=this.cardNo;
         }else{
           sendCardNo=this.cardNo.slice(0,64);//截取健康卡前64位
         }
				this.$emit('ReadedCard', sendCardNo );
      },
         handleClose() {
        this.$confirm('确认取消读卡?')
          .then(_ => {
           this.$router.push({ name: "home" });
          })
          .catch(_ => {
            this.$nextTick(function() {
            this.$refs.autofocus.focus()
        });
          });
      },
      },
  mounted(){
          this.$nextTick(function() {
          this.$refs.autofocus.focus()
        });
  }
};
</script>

<style scoped>

</style>
